<?php
require('lib/verify.php');
require('lib/has_char.php');
require('lib/is_approved.php');

$sysid = $system["system_id"];

$character_id = $_GET["id"];
$sql = "select * from wm_characters where character_id = $character_id and character_system_id = $sysid";
$result = $db->query($sql);

if($db->num_rows($result)<1) {
 header("Location: error-wrong-system.php");
 exit;
}


$chara = $db->fetch_assoc($result);

$_category = "warmath";
$_title = "Wishlist / " . $chara["character_name"];
require('lib/head.php');

if($_GET["error"]!="") {
  boxRed("Error");
?>
    <?=$_GET["error"]?>
<?php
    boxBot();
    }


boxTop("Warmath: $_title");
?>
<?cclass($chara["character_class"])?> <b><a href="character.php?id=<?=$chara["character_id"]?>"><?=$chara["character_name"]?></a>'s Wishlist</b><br/><br/>


<?php
if($system["system_tier"]==4) {
?>

<b>Max</b><br />
<?php
$sql = "select * from wm_wishes left join wm_items on wm_wishes.wish_item = wm_items.item_id where wish_character='$character_id' and wish_level='3'";
$result = $db->query($sql);
while($wish = $db->fetch_assoc($result)) {
  show_link($wish);
$sql = "select * from wm_bosses left join wm_items on wm_items.item_boss = wm_bosses.boss_id where item_id = " . $wish["wish_item"];
$rez = $db->query($sql);
$abo = $db->fetch_assoc($rez);
?>
drops from <a href="boss.php?id=<?=$abo["boss_id"]?>"><?=$abo["boss_name"]?></a><br /><br />
<?php
     }
?>

<br /><br />

<b>Mod</b><br />
<?php
$sql = "select * from wm_wishes left join wm_items on wm_wishes.wish_item = wm_items.item_id where wish_character='$character_id' and wish_level='2'";
$result = $db->query($sql);
while($wish = $db->fetch_assoc($result)) {
  show_link($wish); 
$sql = "select * from wm_bosses left join wm_items on wm_items.item_boss = wm_bosses.boss_id where item_id = " . $wish["wish_item"];
$rez = $db->query($sql);
$abo = $db->fetch_assoc($rez);
?>
drops from <a href="boss.php?id=<?=$abo["boss_id"]?>"><?=$abo["boss_name"]?></a><br /><br />
<?php
     }
?>

<br /><br />

<b>Min</b><br />
<?php
$sql = "select * from wm_wishes left join wm_items on wm_wishes.wish_item = wm_items.item_id where wish_character='$character_id' and wish_level='1'";
$result = $db->query($sql);
while($wish = $db->fetch_assoc($result)) {
  show_link($wish);
$sql = "select * from wm_bosses left join wm_items on wm_items.item_boss = wm_bosses.boss_id where item_id = " . $wish["wish_item"];
$rez = $db->query($sql);
$abo = $db->fetch_assoc($rez);
?>
drops from <a href="boss.php?id=<?=$abo["boss_id"]?>"><?=$abo["boss_name"]?></a><br /><br />
<?php
     }
?>

<?php
}
else {
?>
<b>Max</b><br />
<?php
$sql = "select * from wm_wishes left join wm_items on wm_wishes.wish_item = wm_items.item_id where wish_character='$character_id' and wish_level='4'";
$result = $db->query($sql);
while($wish = $db->fetch_assoc($result)) {
  show_link($wish);
$sql = "select * from wm_bosses left join wm_items on wm_items.item_boss = wm_bosses.boss_id where item_id = " . $wish["wish_item"];
$rez = $db->query($sql);
$abo = $db->fetch_assoc($rez);
?>
drops from <a href="boss.php?id=<?=$abo["boss_id"]?>"><?=$abo["boss_name"]?></a><br /><br />
<?php
     }
?>

<br /><br />

<b>Mod</b><br />
<?php
$sql = "select * from wm_wishes left join wm_items on wm_wishes.wish_item = wm_items.item_id where wish_character='$character_id' and wish_level='3'";
$result = $db->query($sql);
while($wish = $db->fetch_assoc($result)) {
  show_link($wish);
$sql = "select * from wm_bosses left join wm_items on wm_items.item_boss = wm_bosses.boss_id where item_id = " . $wish["wish_item"];
$rez = $db->query($sql);
$abo = $db->fetch_assoc($rez);
?>
drops from <a href="boss.php?id=<?=$abo["boss_id"]?>"><?=$abo["boss_name"]?></a><br /><br />
<?php
     }
?>

<br /><br />

<b>Min</b><br />
<?php
$sql = "select * from wm_wishes left join wm_items on wm_wishes.wish_item = wm_items.item_id where wish_character='$character_id' and wish_level='2'";
$result = $db->query($sql);
while($wish = $db->fetch_assoc($result)) {
  show_link($wish); 
$sql = "select * from wm_bosses left join wm_items on wm_items.item_boss = wm_bosses.boss_id where item_id = " . $wish["wish_item"];
$rez = $db->query($sql);
$abo = $db->fetch_assoc($rez);
?>
drops from <a href="boss.php?id=<?=$abo["boss_id"]?>"><?=$abo["boss_name"]?></a><br /><br />
<?php
     }
?>

<br /><br />

<b>Micro</b><br />
<?php
$sql = "select * from wm_wishes left join wm_items on wm_wishes.wish_item = wm_items.item_id where wish_character='$character_id' and wish_level='1'";
$result = $db->query($sql);
while($wish = $db->fetch_assoc($result)) {
  show_link($wish);
$sql = "select * from wm_bosses left join wm_items on wm_items.item_boss = wm_bosses.boss_id where item_id = " . $wish["wish_item"];
$rez = $db->query($sql);
$abo = $db->fetch_assoc($rez);
?>
drops from <a href="boss.php?id=<?=$abo["boss_id"]?>"><?=$abo["boss_name"]?></a><br /><br />
<?php
     }
?>

<?php
}
?>
<br /><br />

<?php
boxBot();
?>

<?php
require('lib/foot.php');
?>

